//
//  RuleViewController.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/9/28.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "RuleViewController.h"
#import "MineRechargeViewController.h"
#import "TPKeyboardAvoidingScrollView.h"
@interface RuleViewController ()
@property (nonatomic, strong) TPKeyboardAvoidingScrollView *backgroundView;

@end

@implementation RuleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"会员";
    [self addBackItem];
    
    _backgroundView = [[TPKeyboardAvoidingScrollView alloc] initWithFrame:CGRectMake(0, 0, GWIDTH, GHEIGHT - 64)];
    [self.view addSubview:_backgroundView];
    
    if(IS_IPHONE5)
        _backgroundView.contentSize = CGSizeMake(0, GHEIGHT + 60);
    
    UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, GWIDTH - 20, 180)];
    imageview.image = IMAGE(@"rule_top");
    [_backgroundView addSubview:imageview];
    
    UIImageView *bottom = [UIImageView new];
    bottom.image = IMAGE(@"rule");
    [_backgroundView addSubview:bottom];
    [bottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageview.mas_bottom).offset(25);
        make.left.equalTo(self.view).offset(0);
        make.right.equalTo(self.view).offset(0);
        make.height.equalTo(@236);
    }];
    
    UIButton *recharge = [UIButton buttonWithType:UIButtonTypeCustom];
    [recharge setTitle:@"立即充值" forState:0];
    [recharge setTitleColor:ColorFrom16(0x202020) forState:0];
    recharge.backgroundColor = ColorFrom16(0xFFE975);
    recharge.layer.cornerRadius = 26;
    recharge.layer.masksToBounds = YES;
    [recharge addTarget:self action:@selector(handleRecharge) forControlEvents:UIControlEventTouchUpInside];
    [_backgroundView addSubview:recharge];
    [recharge mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bottom.mas_bottom).offset(49);
        make.left.equalTo(self.view).offset(36);
        make.right.equalTo(self.view).offset(-36);
        make.height.equalTo(@52);
    }];
    
}

- (void)handleRecharge
{
    [self.navigationController pushViewController:[MineRechargeViewController new] animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
